/*
题目描述：二叉树的深度
方法：递归即可
 */
public class E55 {
    public static void main(String[] args) {
        TreeNode1 pRoot = new TreeNode1(4);
        pRoot.left = new TreeNode1(2);
        pRoot.left.left = new TreeNode1(1);
        pRoot.left.right = new TreeNode1(3);
        pRoot.right = new TreeNode1(6);
        pRoot.right.left = new TreeNode1(5);
        pRoot.right.right = new TreeNode1(7);

        int res = TreeDepth(pRoot);
        System.out.println(res);
    }

    public static int TreeDepth(TreeNode1 root) {
        if(root == null){
            return 0;
        }
        int left = TreeDepth(root.left);
        int right = TreeDepth(root.right);
        return left > right ? left + 1 : right + 1;
    }
}
